package com.flame.system.tools.exception;

import com.flame.core.exception.ExceptionLevel;
import com.flame.core.exception.ExceptionMessage;

import java.text.MessageFormat;

/**
 * flame_monitor_server 主机信息表
 *
 * @author 吴欣童
 * @since 2022-11-24 21:48:13
 */
public enum ServerExceptionMessage implements ExceptionMessage {
    SERVER_EXIST("100101", "添加失败，数据已存在", ExceptionLevel.INFO),
    CONNECTION_FAILED("100102", "连接失败", ExceptionLevel.INFO);

    private String code;

    private String message;

    private ExceptionLevel level;

    ServerExceptionMessage(String code, String message, ExceptionLevel level) {
        this.code = code;
        this.message = message;
        this.level = level;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public String getMessage(Object... args) {
        return MessageFormat.format(this.message, args);
    }

    @Override
    public ExceptionLevel getLevel() {
        return level;
    }
}
